<!-- <script setup lang="ts">
// import TheWelcome from '../components/TheWelcome.vue'
import useQueryList from "@/hooks/useQueryList"
// import { getAllUser } from "@/api/main/system"
import { reactive } from 'vue';

const condition = reactive({
  username: ""
})
const formatResult = async (pagination: any) => {
  const res = await getAllUser({ ...pagination, ...condition })
  if (res.code == 200) {
    //处理数据在这里处理
    res.data.data.forEach(v => {
      v.isEdit = false
    })
    return {
      data: res.data.data, //渲染的list
      total: res.data.count//总条数
    }
  } else {
    //不然将msg传过去
    return Promise.reject(res.msg)
  }
}
const { list, pagination, total, errorMsg, loading, getList } = useQueryList(formatResult, { watchPage: true })

const change = async () => {
  pagination.page = 2
}

</script>

<template>
  <main>
    <div v-for="item in list" :key="item.id">{{item.isEdit}}</div>
    <button @click="change">改变</button>
    <div>loading:{{loading}}</div>
    <div>msg:{{errorMsg}}</div>
    <div>分页:{{pagination.page}}-{{pagination.psize}}</div>
    <div>总数:{{total}}</div>
    <div v-for="item in list" :key="item.id">{{item.username}}</div>
    <TheWelcome />
  </main>
</template> -->
